Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Organization page with "standalone" theme - Level 2 sitemap #17085

Merged

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Nov 29, 2024

Organization page with "standalone" theme - Level 2 sitemap

What

Level 2 sitemap added (/s/"organization"/"category"/"subcategory")

Screenshots / Gifs

Screen.Recording.2024-12-02.at.14.41.49.mov

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a new sitemap type, STANDALONE_LEVEL2_SITEMAP, enhancing navigation for organization pages.
    • Added a StandaloneLevel2Sitemap component for improved sitemap rendering and user interface.
    • Implemented a new GraphQL query for retrieving hierarchical sitemap structures.
    • Enhanced existing sitemap models to support a detailed representation of nested categories and links.
  • Bug Fixes

    • Improved filtering logic for organization page associations to ensure relevant pages are included in the sitemap.
  • Documentation

    • Updated input types and models to support the new sitemap structure.

Copy link
Contributor

coderabbitai bot commented Nov 29, 2024

Walkthrough

The pull request introduces a new sitemap type, STANDALONE_LEVEL2_SITEMAP, to the existing PageType enum and adds a corresponding StandaloneLevel2Sitemap component. It modifies the routing logic to accommodate this new type and includes new GraphQL queries and input types to support the retrieval of hierarchical sitemap data. Additionally, several models and methods are updated or added to enhance the organization page's sitemap functionality, ensuring structured data representation and improved error handling.

Changes

File Path Change Summary
apps/web/pages/s/[...slugs]/index.tsx Added STANDALONE_LEVEL2_SITEMAP to PageType enum; updated Props interface; added StandaloneLevel2Sitemap to pageMap; modified getProps method for new routing logic.
apps/web/screens/Organization/Standalone/Level2Sitemap.tsx Introduced StandaloneLevel2Sitemap component; added StandaloneLevel2SitemapProps interface; defined getProps static method for data fetching.
apps/web/screens/queries/Organization.tsx Added GET_ORGANIZATION_PAGE_STANDALONE_SITEMAP_LEVEL2_QUERY for fetching standalone sitemap data.
libs/cms/src/lib/cms.contentful.service.ts Added GetOrganizationPageStandaloneSitemapLevel2Input type and OrganizationPageStandaloneSitemapLevel2 model; modified URL construction logic; added getOrganizationPageStandaloneSitemapLevel2 method.
libs/cms/src/lib/cms.resolver.ts Added getOrganizationPageStandaloneSitemapLevel2 query method; updated imports for new models and input types.
libs/cms/src/lib/dto/getOrganizationPageStandaloneSitemap.input.ts Introduced GetOrganizationPageStandaloneSitemapLevel2Input class with additional subcategorySlug field.
libs/cms/src/lib/models/organizationPageStandaloneSitemap.model.ts Added new classes: OrganizationPageStandaloneSitemapLevel2Link, OrganizationPageStandaloneSitemapLevel2Category, and OrganizationPageStandaloneSitemapLevel2.
libs/cms/src/lib/models/organizationParentSubpage.model.ts Updated mapOrganizationParentSubpage function to include new filtering logic based on organization page ID.

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • mannipje

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/[email protected]: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/[email protected]: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning jest > @jest/core > jest-config > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-runtime > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/reporters > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/transform > babel-plugin-istanbul > test-exclude > [email protected]: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > puppeteer-core > [email protected]: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > puppeteer-core > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > tempy > del > [email protected]: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > jscodeshift > temp > [email protected]: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > jscodeshift > temp > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > jscodeshift > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning storybook > @storybook/cli > jscodeshift > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning storybook > @storybook/cli > jscodeshift > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning next-auth > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning next-auth > [email protected]: this version is no longer supported
warning next-auth > @next-auth/typeorm-legacy-adapter > typeorm > [email protected]: Glob versions prior to v9 are no longer supported
warning @nx/next > @nx/webpack > stylus > [email protected]: Glob versions prior to v9 are no longer supported
warning @nx/next > @nx/webpack > webpack-dev-server > [email protected]: Rimraf versions prior to v4 are no longer supported
warning @nx/next > @nx/webpack > fork-ts-checker-webpack-plugin > [email protected]: this will be v4
warning @nx/next > @nx/webpack > webpack-dev-server > webpack-dev-middleware > [email protected]: this will be v4
warning workspace-aggregator-2ab2dd19-3b92-4f3f-a23c-cf95733b66e5 > [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 14.65517% with 99 lines in your changes missing coverage. Please review.

Project coverage is 35.66%. Comparing base (a621cbe) to head (7c32b16).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
libs/cms/src/lib/cms.contentful.service.ts 0.00% 56 Missing ⚠️
.../screens/Organization/Standalone/Level2Sitemap.tsx 0.00% 26 Missing ⚠️
apps/web/pages/s/[...slugs]/index.tsx 0.00% 9 Missing ⚠️
.../models/organizationPageStandaloneSitemap.model.ts 76.92% 3 Missing ⚠️
libs/cms/src/lib/cms.resolver.ts 71.42% 2 Missing ⚠️
.../src/lib/models/organizationParentSubpage.model.ts 0.00% 2 Missing ⚠️
apps/web/screens/queries/Organization.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17085      +/-   ##
==========================================
- Coverage   35.68%   35.66%   -0.02%     
==========================================
  Files        6946     6947       +1     
  Lines      147401   147512     +111     
  Branches    41904    41938      +34     
==========================================
+ Hits        52600    52615      +15     
- Misses      94801    94897      +96     
Flag Coverage Δ
api 3.34% <ø> (ø)
api-domains-auth-admin 48.49% <ø> (ø)
api-domains-communications 39.36% <18.98%> (-0.17%) ⬇️
application-system-api 38.70% <21.25%> (-0.04%) ⬇️
application-template-api-modules 27.79% <18.98%> (-0.02%) ⬇️
cms 0.40% <0.00%> (-0.01%) ⬇️
cms-translations 38.69% <18.98%> (-0.17%) ⬇️
judicial-system-api 19.99% <ø> (ø)
judicial-system-backend 55.53% <21.25%> (-0.14%) ⬇️
services-user-notification 46.57% <21.25%> (-0.17%) ⬇️
web 2.43% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../dto/getOrganizationPageStandaloneSitemap.input.ts 90.00% <100.00%> (+2.50%) ⬆️
apps/web/screens/queries/Organization.tsx 0.00% <0.00%> (ø)
libs/cms/src/lib/cms.resolver.ts 66.84% <71.42%> (-0.07%) ⬇️
.../src/lib/models/organizationParentSubpage.model.ts 47.82% <0.00%> (-4.56%) ⬇️
.../models/organizationPageStandaloneSitemap.model.ts 78.26% <76.92%> (-1.74%) ⬇️
apps/web/pages/s/[...slugs]/index.tsx 0.00% <0.00%> (ø)
.../screens/Organization/Standalone/Level2Sitemap.tsx 0.00% <0.00%> (ø)
libs/cms/src/lib/cms.contentful.service.ts 9.89% <0.00%> (-1.25%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ebd9b8f...7c32b16. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 29, 2024

Datadog Report

All test runs 1b87799 🔗

11 Total Test Services: 0 Failed, 10 Passed
🔻 Test Sessions change in coverage: 5 decreased, 24 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 2.41s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 10.22s 1 no change Link
api-domains-communications 0 0 0 5 0 29.47s 1 decreased (-0.22%) Link
api-domains-license-service 0 0 0 0 0 497.58ms 1 no change Link
application-system-api 0 0 0 40 0 2m 14.59s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 4.16s 1 no change Link
cms-translations 0 0 0 3 0 25.47s 1 decreased (-0.23%) Link
judicial-system-api 0 0 0 61 0 5.27s 1 no change Link
judicial-system-backend 0 0 0 21000 0 17m 14.62s 1 decreased (-0.14%) Link
services-user-notification 0 0 0 51 0 1m 26.03s 1 decreased (-0.15%) Link

🔻 Code Coverage Decreases vs Default Branch (5)

  • cms-translations - jest 48.14% (-0.23%) - Details
  • api-domains-communications - jest 48.5% (-0.22%) - Details
  • services-user-notification - jest 69.04% (-0.15%) - Details
  • judicial-system-backend - jest 59.16% (-0.14%) - Details
  • web - jest 3.28% (-0.01%) - Details

@RunarVestmann RunarVestmann marked this pull request as ready for review December 2, 2024 14:43
@RunarVestmann RunarVestmann requested review from a team as code owners December 2, 2024 14:43
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (2)
apps/web/screens/Organization/Standalone/Level2Sitemap.tsx (1)

109-176: Consider using Next.js data fetching methods for better alignment with best practices.

The getProps method attached to the StandaloneLevel2Sitemap component is unconventional in Next.js. Typically, data fetching is performed using getStaticProps or getServerSideProps at the page level. Refactoring to use getStaticProps would adhere to Next.js best practices for static generation and improve clarity.

apps/web/pages/s/[...slugs]/index.tsx (1)

336-347: Consider enhancing error handling with logging.

While the error handling correctly differentiates between CustomNextError and other exceptions, consider adding error logging for better observability.

 try {
   return {
     page: {
       type: PageType.STANDALONE_LEVEL2_SITEMAP,
       props: await StandaloneLevel2Sitemap.getProps(modifiedContext),
     },
   }
 } catch (error) {
+  console.error('Failed to get Level 2 sitemap props:', error)
   if (!(error instanceof CustomNextError)) {
     throw error
   }
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 918cf3b and 86cec07.

⛔ Files ignored due to path filters (1)
  • libs/cms/src/lib/generated/contentfulTypes.d.ts is excluded by !**/generated/**
📒 Files selected for processing (8)
  • apps/web/pages/s/[...slugs]/index.tsx (5 hunks)
  • apps/web/screens/Organization/Standalone/Level2Sitemap.tsx (1 hunks)
  • apps/web/screens/queries/Organization.tsx (1 hunks)
  • libs/cms/src/lib/cms.contentful.service.ts (3 hunks)
  • libs/cms/src/lib/cms.resolver.ts (2 hunks)
  • libs/cms/src/lib/dto/getOrganizationPageStandaloneSitemap.input.ts (1 hunks)
  • libs/cms/src/lib/models/organizationPageStandaloneSitemap.model.ts (1 hunks)
  • libs/cms/src/lib/models/organizationParentSubpage.model.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
libs/cms/src/lib/dto/getOrganizationPageStandaloneSitemap.input.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
apps/web/screens/Organization/Standalone/Level2Sitemap.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/cms/src/lib/models/organizationParentSubpage.model.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
apps/web/screens/queries/Organization.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/pages/s/[...slugs]/index.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/cms/src/lib/models/organizationPageStandaloneSitemap.model.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/cms/src/lib/cms.resolver.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/cms/src/lib/cms.contentful.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (6)
libs/cms/src/lib/dto/getOrganizationPageStandaloneSitemap.input.ts (1)

21-25: Input type extension is well-defined and appropriate.

The GetOrganizationPageStandaloneSitemapLevel2Input class correctly extends the GetOrganizationPageStandaloneSitemapLevel1Input and adds the required subcategorySlug field, enhancing the input schema for level 2 sitemaps.

libs/cms/src/lib/models/organizationPageStandaloneSitemap.model.ts (1)

22-50: New GraphQL object types are well-defined and enhance the sitemap model.

The addition of OrganizationPageStandaloneSitemapLevel2Link, OrganizationPageStandaloneSitemapLevel2Category, and OrganizationPageStandaloneSitemapLevel2 effectively extends the sitemap model to support level 2 sitemaps, providing a more detailed hierarchical structure.

libs/cms/src/lib/models/organizationParentSubpage.model.ts (1)

38-39: Filter enhancement ensures correct association of pages.

The added condition in the filter method verifies that each page's organizationPage ID matches the parent organizationPage ID. This ensures that only pages belonging to the correct organization are included, improving data accuracy.

apps/web/screens/queries/Organization.tsx (1)

449-465: Well-structured GraphQL query for hierarchical sitemap data!

The query is well-designed with a clear hierarchical structure that properly represents the sitemap levels through nested fields (label, childCategories, childLinks).

apps/web/pages/s/[...slugs]/index.tsx (1)

330-349: Well-implemented routing logic for Level 2 sitemap!

The implementation:

  • Correctly validates the standalone theme
  • Properly checks top-level navigation links
  • Has appropriate error handling
  • Falls back to parent subpage when needed
libs/cms/src/lib/cms.resolver.ts (1)

739-747: Clean and consistent resolver implementation!

The implementation:

  • Uses appropriate cache control
  • Has proper typing for input and return values
  • Follows the established patterns in the codebase

libs/cms/src/lib/cms.contentful.service.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
libs/cms/src/lib/cms.contentful.service.ts (1)

1288-1435: Consider refactoring repeated patterns in sitemap traversal.

The implementation is thorough but contains repeated patterns for handling different node types. Consider extracting common logic into helper functions:

  1. Node type checking and transformation
  2. Entry node handling
  3. URL construction

Example refactor for node transformation:

+private transformSitemapNode(
+  node: SitemapTreeNode,
+  entryNodes: Map<string, any[]>,
+  input: GetOrganizationPageStandaloneSitemapLevel2Input
+) {
+  if (node.type === SitemapTreeNodeType.CATEGORY) {
+    return {
+      label: node.label,
+      childLinks: node.childNodes.map(childNode => 
+        this.transformSitemapNode(childNode, entryNodes, input)
+      ),
+    }
+  }
+  if (node.type === SitemapTreeNodeType.URL) {
+    return {
+      label: node.label,
+      href: node.url,
+      childLinks: [],
+    }
+  }
+  return this.createEntryNode(node.entryId, entryNodes)
+}

This would make the code more maintainable and reduce duplication.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 86cec07 and e29cff6.

📒 Files selected for processing (2)
  • libs/cms/src/lib/cms.contentful.service.ts (3 hunks)
  • libs/cms/src/lib/models/organizationParentSubpage.model.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/cms/src/lib/models/organizationParentSubpage.model.ts
🧰 Additional context used
📓 Path-based instructions (1)
libs/cms/src/lib/cms.contentful.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (5)
libs/cms/src/lib/cms.contentful.service.ts (5)

91-98: LGTM: Import statements are well-organized.

The new imports for sitemap types and models are properly structured.


1228-1228: LGTM: URL construction and data validation improvements.

The changes correctly:

  1. Enhance URL construction by incorporating categorySlug
  2. Add proper data validation by pruning empty values

Also applies to: 1280-1282


1300-1300: Fix the error handler name.

The error handler name should be 'getOrganizationPageStandaloneSitemapLevel2' instead of 'getOrganizationPageStandaloneSitemapLevel1'.


1304-1326: LGTM: Robust null checking and type validation.

The implementation properly validates:

  1. Tree existence
  2. Category existence
  3. Subcategory existence and type
  4. Edge cases with proper null returns

This ensures type safety and prevents runtime errors.


1424-1433: LGTM: Comprehensive data cleanup.

The pruning logic effectively removes invalid entries by:

  1. Filtering out links without required fields
  2. Ensuring categories have valid labels and non-empty child links

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
libs/cms/src/lib/cms.contentful.service.ts (1)

Line range hint 1228-1286: Consider using URL builder utility for consistent path construction.

The URL construction is spread across multiple string interpolations. Consider extracting this into a utility function to ensure consistent URL construction and make it easier to update path patterns.

Example implementation:

+ const buildOrganizationUrl = (lang: string, organizationSlug: string, ...segments: string[]) => 
+   `/${getOrganizationPageUrlPrefix(lang)}/${organizationSlug}/${segments.join('/')}`;

- href: `/${getOrganizationPageUrlPrefix(input.lang)}/${input.organizationPageSlug}/${input.categorySlug}/${node.slug}`,
+ href: buildOrganizationUrl(input.lang, input.organizationPageSlug, input.categorySlug, node.slug),
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e29cff6 and 850ae44.

📒 Files selected for processing (2)
  • apps/web/pages/s/[...slugs]/index.tsx (5 hunks)
  • libs/cms/src/lib/cms.contentful.service.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/pages/s/[...slugs]/index.tsx
🧰 Additional context used
📓 Path-based instructions (1)
libs/cms/src/lib/cms.contentful.service.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (2)
libs/cms/src/lib/cms.contentful.service.ts (2)

91-98: LGTM: Import statements are well-organized.

The new imports for sitemap-related types and models are properly structured.


1300-1300: Correct the error handler name in the catch block.

The error handler name should match the method name for accurate error logging.

libs/cms/src/lib/cms.contentful.service.ts Show resolved Hide resolved
@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants